<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
<title>会员中心-{$web_config['web_title']}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta name="renderer" content="webkit">
<link href="/assets/css/frontend.min.css?v=1.0.1" rel="stylesheet">

<!-- HTML5 shim, for IE6-8 support of HTML5 elements. All other JS at the end of file. -->
<!--[if lt IE 9]>
  <script src="/assets/js/html5shiv.js"></script>
  <script src="/assets/js/respond.min.js"></script>
<![endif]-->
        <link href="/assets/css/user.css?v=1.0.1" rel="stylesheet">
		<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
	<script type="text/javascript" charset="utf-8" src="/ueditor/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="/ueditor/ueditor.all.min.js"> </script>
    <!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
    <!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
    <script type="text/javascript" charset="utf-8" src="/ueditor/lang/zh-cn/zh-cn.js"></script>
    </head>

    <body>
        {include file="header"}
        <main class="content">
            <style>
    .basicinfo {
        margin: 15px 0;
    }

    .basicinfo .row > .col-xs-4 {
        padding-right: 0;
    }

    .basicinfo .row > div {
        margin: 5px 0;
    }
</style>
<div id="content-container" class="container">
    <div class="row">
        {include file="user_left"}





<div class="col-md-10">

      <div class="panel panel-default ">
        <div class="panel-body">
          <div id="myTabContent" class="tab-content">
          <div class="tab-pane fade active in" id="one">
          <form name="form" role="form" id="adds-form" class="form-horizontal" method="POST" action="">
		  
			<div class="form-group">
              <label class="control-label col-xs-12 col-sm-2">平台选择:</label>
              <div class="col-xs-12 col-sm-8">
                <div class="radio" id="platid">
					{volist name="task_platform" id="vo" key="k"}
					<label><input  name="tpf_id" type="radio" value="{$vo.tpf_id}" {if $k==1}checked{/if}>{$vo.tpf_title}</label>
					{/volist}
				</div>
              </div>
            </div>

            <div class="form-group">
              <label class="control-label col-xs-12 col-sm-2">类型选择:</label>
              <div class="col-xs-12 col-sm-8">
                <div class="radio" id="platid">
					{volist name="task_type" id="vo" key="k"}
					<label><input  name="tt_id" type="radio" value="{$vo.tt_id}" {if $k==1}checked{/if}>{$vo.tt_title}</label>
					{/volist}
				</div>
              </div>
            </div>
			
			
			<div class="form-group">
              <label class="control-label col-xs-12 col-sm-2">店铺名称:</label>
              <div class="col-xs-12 col-sm-8">
                <input name="dpname" id="dpname" class="form-control" type="text" placeholder="店铺名称">
              </div>
            </div>
			
			<div class="form-group">
              <label class="control-label col-xs-12 col-sm-2">链接网址:</label>
              <div class="col-xs-12 col-sm-8">
                <input name="url" id="url" class="form-control" type="text" placeholder="链接网址">
              </div>
            </div>
			
			<div class="form-group">
              <label class="control-label col-xs-2 col-sm-2">任务数量:</label>
              <div class="col-xs-3 col-sm-3">
                <input name="count" id="count" class="form-control" type="text" placeholder="任务数量">
              </div>
			  <label class="control-label col-xs-2 col-sm-2">任务单价:</label>
              <div class="col-xs-3 col-sm-3">
                <input name="money" id="money" class="form-control" type="text" placeholder="任务单价">
              </div>
            </div>
			

            <div class="form-group">
              <label class="control-label col-xs-12 col-sm-2">任务描述:</label>
              <div class="col-xs-12 col-sm-8">
                <script id="editor" type="text/plain" style="width:100%;height:260px;"></script>
              </div>
            </div>

                        <div class="form-group layer-footer">
              <label class="control-label col-xs-12 col-sm-2"></label>
              <div class="col-xs-12 col-sm-4">
                <!--<button type="button" class="btn btn-danger btn-dialog">检查格式</button>-->
                <div type="submit" class="btn btn-success btn-embossed sub">提交下单</div>
              </div>
            </div>		  	
          </form>
          </div>
          </div>
          </div>
      </div>
    </div>
    </div>
</div>
        </main>
		{include file="footer_content"}
<script>
var ue = UE.getEditor('editor');
$(".sub").click(function(){
	var tpf_id = $("input[name='tpf_id']:checked").val();
	var tt_id  = $("input[name='tt_id']:checked").val();
	//var title  = $("#title").val();
	var dpname  = $("#dpname").val();
	var url    = $("#url").val();
	var count  = $("#count").val();
	var money  = $("#money").val();
	var editor = UE.getEditor('editor').getContent();

	if(tpf_id ==""){
		alert("平台不能为空，请先选择！");
		return false;
	}
	
	if(tt_id ==""){
		alert("类型不能为空，请先选择！");
		return false;
	}
	
	//if(title ==""){
	//	alert("任务标题不能为空！");
	//	return false;
	//}
	
	if(dpname ==""){
		alert("店铺名称不能为空！");
		return false;
	}
	
	
	if(count ==""){
		alert("任务数量不能为空！");
		return false;
	}
	
	if(money ==""){
		alert("任务单价不能为空！");
		return false;
	}
	
	
	$.ajax({
		type:"POST",
		url:"{:url('task/add')}",
		dataType:"json",
		data:{
			tpf_id:tpf_id,
			tt_id:tt_id,
			//title:title,
			dpname:dpname,
			url:url,
			count:count,
			money:money,
			editor:editor,
		},
		success:function(res){
			if(res.status == "success"){
				window.location.href = "{:url('task/index',array('type'=>'user'))}";
			}else{
				alert(res.data);
			}
		},
		error:function(jqXHR){
			console.log("Error: "+jqXHR.status);
		},
	});
	
});


function select_fun(id,money)
{

	$.ajax({
		type:"POST",
		url:"{:url('order/change')}",
		dataType:"json",
		data:{
			id:id,
		},
		success:function(res){
			var z_money = money + res.freight.f_money;
			$("#f_money").html(res.freight.f_money);
			$("#z_money").html(z_money.toFixed(1));
			$("#platid").html(" ");
			var len = res.platform.length;
			var html = "";
			for (var i = 0; i < len; i++){
				if(res.platform[i].pf_content==""){
					html = html + "<label><input  name='plattype' type='radio' value='"+res.platform[i].pf_id+"' checked>"+res.platform[i].pf_title+"</label> ";
				}else{
					html = html + "<label><input  name='plattype' type='radio' value='"+res.platform[i].pf_id+"' checked>"+res.platform[i].pf_title+"（"+res.platform[i].pf_content+"）</label> ";
				}
			}
			$("#platid").html(html);
		},
		error:function(jqXHR){
			console.log("Error: "+jqXHR.status);
		},
	});
}
</script>
    </body>
</html>